﻿using ProjBackEnd.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace ProjBackEnd.Areas.BizProj.Models
{
    
    public class ReqBizFeeBase : BaseUserRequest
    {
        /// <summary>
        /// 业务费用信息
        /// </summary>
        [Required(ErrorMessage ="业务费用信息是必需的")]
        public BizFeeBaseInfo bizfeeinfo { get; set; }
    }

    /// <summary>
    /// 业务费用结果集
    /// </summary>
    public class ResultBizFee : BaseResultInfo
    {
        /// <summary>
        /// 业务费用列表
        /// </summary>
        public List<BizFeeExtInfo> bizfeelist { get; set; } = new List<BizFeeExtInfo>();
    }

    /// <summary>
    /// i 业务费用核心（用于敏感信息维护）
    /// </summary>
    public class BizFeeCore : BaseOperableEntity
    {
        /// <summary>
        /// 业务费用流水号
        /// </summary>
        [RequiredConditional("optlb","UD",ErrorMessage = "业务费用流水号是必需的")]
        public int feeid { get; set; }
        /// <summary>
        /// 公司代码
        /// </summary>
        public string comcd { get; set; }
        /// <summary>
        /// 项目流水号
        /// </summary>
        public int projid { get; set; }
        /// <summary>
        /// 合同流水号
        /// </summary>
        public int ctid { get; set; }
        /// <summary>
        /// 合同分项流水号
        /// </summary>
        public int ctsubid { get; set; }
        /// <summary>
        /// 合同清单流水号
        /// </summary>
        public int projdtlid { get; set; }
        /// <summary>
        /// 账单流水号
        /// </summary>
        public int billid { get; set; }
        /// <summary>
        /// 收付费客户id
        /// </summary>
        public int cusid { get; set; }
        /// <summary>
        /// 进程id：0-建档；1-已做账单；2-收付款中；9-实收实付完成
        /// </summary>
        public string pid { get; set; }
        /// <summary>
        /// 收付费标志：R-收费；P-付费
        /// </summary>
        public string rplb { get; set; }
    }

    /// <summary>
    /// ii 业务费用基本信息（用于基本增删改）
    /// </summary>
    public class BizFeeBaseInfo : BizFeeCore
    {
        /// <summary>
        /// 费用描述
        /// </summary>
        public string objdesc { get; set; }
        /// <summary>
        /// 费用类别
        /// </summary>
        public string objtp { get; set; }
        /// <summary>
        /// 品牌
        /// </summary>
        public string brand { get; set; }
        /// <summary>
        /// 型号
        /// </summary>
        public string model { get; set; }
        /// <summary>
        /// 规格
        /// </summary>
        public string spec { get; set; }
        /// <summary>
        /// 数量
        /// </summary>
        public decimal num { get; set; }
        /// <summary>
        /// 单位（个、台、批等）
        /// </summary>
        public string unit { get; set; }
        /// <summary>
        /// 应付单价
        /// </summary>
        public decimal amt_payprice { get; set; }
        /// <summary>
        /// 应付总价
        /// </summary>
        public decimal amt_paytotal { get; set; }
        /// <summary>
        /// 税率
        /// </summary>
        public decimal taxrate { get; set; }
        /// <summary>
        /// 应收单价
        /// </summary>
        public decimal amt_recprice { get; set; }
        /// <summary>
        /// 应收总价
        /// </summary>
        public decimal amt_rectotal { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string remark { get; set; }
        /// <summary>
        /// 业务发生时间
        /// </summary>
        public string purchasdt { get; set; }
        /// <summary>
        /// 发票类型（对应CD_BASIC.ATTRCD = 'FPLX'）
        /// </summary>
        public string invotp { get; set; } = "";
    }

    /// <summary>
    /// iii 业务费用扩展信息（用于展示）
    /// </summary>
    public class BizFeeExtInfo : BizFeeBaseInfo
    {
        /// <summary>
        /// 收付费客户名称
        /// </summary>
        public string cusnm { get; set; }
        /// <summary>
        /// 收付费客户助记码
        /// </summary>
        public string cuscd { get; set; }
        /// <summary>
        /// 类别名称
        /// </summary>
        public string objtpnm { get; set; }
        /// <summary>
        /// 品牌名称
        /// </summary>
        public string brandnm { get; set; }
        /// <summary>
        /// 建档人姓名
        /// </summary>
        public string creator { get; set; }
        /// <summary>
        /// 建档时间
        /// </summary>
        public string createdt { get; set; }
        /// <summary>
        /// 进程解释
        /// </summary>
        public string piddesc { get; set; }
        /// <summary>
        /// 归属项目名
        /// </summary>
        public string projnm { get; set; }
        /// <summary>
        /// 归属项目明细名称
        /// </summary>
        public string projdtlnm { get; set; }
        /// <summary>
        /// 所属业务账单进程
        /// </summary>
        public string billpid { get; set; } = "";
        /// <summary>
        /// 所属业务账单进程名称
        /// </summary>
        public string billpidnm { get; set; } = "";
        /// <summary>
        /// 发票类型名称
        /// </summary>
        public string invotpnm { get; set; } = "";
    }

    /// <summary>
    /// 费用归属结果集
    /// </summary>
    public class ResultBizFeeHeader : BaseResultInfo
    {
        /// <summary>
        /// 费用归属信息列表
        /// </summary>
        public List<BizFeeHeader> headerlist { get; set; }
    }

    /// <summary>
    /// 费用归属信息
    /// </summary>
    public class BizFeeHeader
    {
        /// <summary>
        /// 费用id
        /// </summary>
        public int feeid { get; set; }
        /// <summary>
        /// 项目名称
        /// </summary>
        public string projnm { get; set; } = "";
        /// <summary>
        /// 合同名称
        /// </summary>
        public string ctnm { get; set; } = "";
        /// <summary>
        /// 合同子项名称
        /// </summary>
        public string ctsubnm { get; set; } = "";
        /// <summary>
        /// 明细名称
        /// </summary>
        public string projdtlnm { get; set; } = "";
    }

}